package kz.kstu.scantest.business.entity.form;

import kz.kstu.scantest.business.entity.data.FieldNameEnum;

/**
 * @author Filipp_Stankevich
 *         created: 08.09.11 15:49
 */
public class Field {

    //the position index starts with 0
    private int startPosition;
    private int length;
    private FieldNameEnum fieldName;

    public int getStartPosition() {
        return startPosition;
    }

    public void setStartPosition(int startPosition) {
        this.startPosition = startPosition;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public FieldNameEnum getFieldName() {
        return fieldName;
    }

    public void setFieldName(FieldNameEnum fieldName) {
        this.fieldName = fieldName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Field field = (Field) o;
        return (fieldName == field.fieldName);
    }

    @Override
    public int hashCode() {
        return fieldName != null ? fieldName.hashCode() : 0;
    }
}
